package com.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;

import com.application.BaseApplication;


public class NetWorkUtil {

	public static boolean checkWfiIsOpen() {

		WifiManager wifiManager = (WifiManager) BaseApplication.getContext()
				.getSystemService(Context.WIFI_SERVICE);
		if (wifiManager.getWifiState() == 3) {
			return true;
		} else {
			return false;
		}
	}


	public static boolean checkMobileNetWorkIsOpen() {
		ConnectivityManager conManager = (ConnectivityManager) BaseApplication.getContext()
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		boolean isConnFlag = false;
		NetworkInfo network = conManager.getActiveNetworkInfo();
		if (network != null) {
			isConnFlag = conManager.getActiveNetworkInfo().isAvailable();
		}
		return isConnFlag;
	}
}
